package com.penghaisoft.microwms.material.web.outwarehouse.service.impl;

import com.penghaisoft.microwms.common.data.model.RawHandOutSn;
import com.penghaisoft.microwms.common.page.Pager;
import com.penghaisoft.microwms.common.service.BaseService;
import com.penghaisoft.microwms.material.web.outwarehouse.dao.RawHandOutSnMapper;
import com.penghaisoft.microwms.material.web.outwarehouse.service.RawHandOutSnService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by 王治国 on 2018/5/25.
 */
@Service
public class RawHandOutSnServiceImpl extends BaseService implements RawHandOutSnService {

    @Autowired
    private RawHandOutSnMapper rawHandOutSnMapper;

    @Override
    public Pager<RawHandOutSn> findAll(int page, int rows, RawHandOutSn rawHandOutSn) {
        long size = rawHandOutSnMapper.queryCount(rawHandOutSn);
        Pager<RawHandOutSn> pager = new Pager<>();
        List<RawHandOutSn> result = new ArrayList<>();
        pager.setPage(page);
        pager.setRows(rows);
        if (size > 0) {
            result = rawHandOutSnMapper.queryList(pager, rawHandOutSn);
        }
        pager.setRecords(result);
        pager.setTotalCount(size);
        return pager;
    }

    @Override
    public List<RawHandOutSn> findAllExcel(RawHandOutSn rawHandOutSn) {
        return null;
    }
}
